<?php

declare(strict_types=1);

namespace App\Http\Controllers\Es;
use  App\Models\Elasticsearch\Control;

class Test extends BaseController
{
    public function add(){
        $params = [
            'index' => 'my_index4',
            'body' => [
                'settings' => [
                    'number_of_shards' => 3,
                    'number_of_replicas' => 2
                ],
                'mappings' => [
                    '_source' => [
                        'enabled' => true
                    ],
                    'properties' => [
                        'first_name' => [
                            'type' => 'keyword'
                        ],
                        'age' => [
                            'type' => 'integer'
                        ]
                    ]
                ]
            ]
        ];
    //    var_dump( Connect::getDriver()->indices()->create($params) );
    Control::indices()->create($params) ;

    }

    public function get(){
        Control::indices()->get();
    }
}
